<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>1.两数之和</title>
</head>

<body>

</body>

<script>
    /**
     * @param {number[]} nums
     * @param {number} target
     * @return {number[]}
     */
    var twoSum = function (nums, target) {
        if (nums.length < 2) {
            return [];
        } else {
            let arr = [];
            for (let i = 0; i <= nums.length - 1; i++) {
                for (let j = i + 1; j <= nums.length - 1; j++) {
                    if (nums[i] + nums[j] === target) {
                        arr.push(i, j);
                    }
                }
            } return arr;
        }
    };
    console.log(twoSum([3, 2, 3], 6));
</script>

</html>